<extend name="Public/base"/>

<block name="body">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
		var status = $("#sch-sort-txt").attr("data");
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
		if(status != ''){
			query += 'status=' + status + "&" + query;
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	$(".search-form").find(".drop-down").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
	},function(){
		$("#sub-sch-menu").addClass("hidden");
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

    $('#time-start').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
	    minView:2,
	    autoclose:true
    });

    $('#time-end').datetimepicker({
       format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true,
        pickerPosition:'bottom-left'
    })
    
})
</script>
	<div class="main-title">
		<h2>提现记录</h2>
	</div>
	<div class="cf">
		<a class="btn" href="__URL__/index">全部</a>
		<a class="btn" href="__URL__/index/status/0">待处理</a>
		<a class="btn" href="__URL__/index/status/1">已转账</a>
		<a class="btn" href="__URL__/index/status/2">已驳回</a>
		<button class="btn" target-form="ids" onclick="javascript:exportexl();">导出Excel</button>
	</div>
	<div class="cf" style="margin-top:10px;">
		<div class="search-form  cf">
			<div class="btn-group-click adv-sch-pannel fl">
               	<div class="row">
               		<label>申请时间：</label>
               		<input type="text" id="time-start" name="time-start" class="text input-2x" value="{:I('time-start')}" placeholder="起始时间" /> -
               		<input type="text" id="time-end" name="time-end" class="text input-2x" value="{:I('time-end')}" placeholder="结束时间" />
               	</div>
            </div>
			<div class="sleft">
				<!-- <div class="drop-down">
					<span id="sch-sort-txt" class="sort-txt" data="{$status}"><if condition="get_status_title($status) eq ''">所有<else/>{:get_status_title($status)}</if></span>
					<i class="arrow arrow-down"></i>
				</div>
				<input type="text" name="login_user" class="search-input" value="{:I('login_user')}" placeholder="请输入用户名"> -->
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('BrokerageWithdrawRecord/index','pid='.I('pid',0).'&cate_id='.$cate_id,false)}"><i class="btn-search"></i></a>
			</div>
          
		</div>
	</div>
	
	<div class="data-table table-striped">
		<table>
			<thead>
				<tr>
					<th class="row-selected">
						<input class="checkbox check-all" type="checkbox">
					</th>
					<th>ID</th>
					<th>开户行</th>
					<th>银行卡号</th>
					<th>预留手机号</th>
					<th>申请用户</th>
					<th>申请时间</th>
					<th>提现金额</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="list">
				<volist name="list" id="channel">
				<?php
				$bank=M('Bank')->where('id='.$channel['bank_id'])->find();
				?>
					<tr>
						<td><input class="ids row-selected" type="checkbox" name="ids[]" id="" value="{$channel['id']}"> </td>
						<td>{$channel.id}</td>
						<td>{:getbank($channel['banktype'])}</td>
						<td>{:getbankcard($channel['bank_id'])}</td>
						<td>{:getbankphone($channel['user_id'])}</td>
						<td>{:getbankname($channel['user_id'])}</td>
						<td>{:date("Y-m-d",$channel['addtime'])}</td>
						<td>{$channel.money}</td>
						<td>{$statusarr[$channel['status']]}</td>
						<td>
						<a href="__URL__/info/id/{$channel.id}" >详细</a>
						<if condition="$channel['status'] eq 0">
							<a class="confirm ajax-get" title="确认转账" href="__URL__/upstatus/id/{$channel.id}">确认转账</a>
							<a title="驳回" href="__URL__/del/id/{$channel.id}">驳回</a>
						</if>
						</td>
					</tr>
				</volist>
				<else/>
				<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
	</div>
		<div class="page">
        {$page}
		</div>
</block>

<block name="script">
<script type="text/javascript">
	//导航高亮
	highlight_subnav('{:U('BrokerageWithdrawRecord/index')}');
	
    $(function() {
    	//点击排序
    	$('.list_sort').click(function(){
    		var url = $(this).attr('url');
    		var ids = $('.ids:checked');
    		var param = '';
    		if(ids.length > 0){
    			var str = new Array();
    			ids.each(function(){
    				str.push($(this).val());
    			});
    			param = str.join(',');
    		}

    		if(url != undefined && url != ''){
    			window.location.href = url + '/ids/' + param;
    		}
    	});
    });

    function exportexl(){
    	var ids = "";
    	$(".ids").each(function(i,e){
    		if($(this).is(":checked")){
    			ids += $(this).val()+",";
    		}
    	});
    	var url = "{$excel_url}";
    	if(ids!="") url+="&ids="+ids;
    	location.href = url;
    }
</script>
</block>